package com.beiing.tianshuai.tianshuai.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.AddFriendsBean;
import com.beiing.tianshuai.tianshuai.model.AddFriendsModel;
import com.beiing.tianshuai.tianshuai.model.AddFriendsModelImpl;
import com.beiing.tianshuai.tianshuai.view.AddFriendsViewImpl;

/**
 * Created by Jinni on 2017/8/8 0008.
 */

public class AddFriendsPresenter extends BasePresenter implements AddFriendsPresenterImpl, AddFriendsModel.OnRequestListener{

    private AddFriendsModelImpl     mModel;
    private AddFriendsViewImpl      mView;

    public AddFriendsPresenter(AddFriendsViewImpl view) {
        mView = view;
        mModel = new AddFriendsModel(this);
    }

    @Override
    public void getAddFriendsResult(String fromId, String toId, String message) {
        mView.showProgress();
        mModel.getAddFriendsResult(fromId, toId, message);
    }

    @Override
    public void onSuccess(AddFriendsBean bean) {
        mView.hideProgress();
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onError(Throwable throwable) {
        mView.hideProgress();
        mView.onRequestFailed(throwable);
    }
}
